<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('产品信息（下游/甲方）列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>

                            <li>
                                <label>产品ID：</label>
                                <input type="number" name="id"/>
                            </li>
                            <li>
                                <label class="font-noraml">产品名称：</label>
                                <div class="col-sm-2" >
                                    <select name="productName" class="form-control">
                                        <option value="">所有</option>
                                        <option  th:each="item:${productList}" th:text="${item.name}" th:value="${item.name}"></option>
                                    </select>
                                </div>
                            </li>

<!--                            <li>-->
<!--                                <label>产品类型：</label>-->
<!--                                <select name="channelType" class="form-control">-->
<!--                                    <option value="">所有</option>-->
<!--                                    <option  th:each="item:${channelTypeList}" th:text="${item.name}" th:value="${item.value}" ></option>-->
<!--                                </select>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>logo地址：</label>-->
<!--                                <input type="text" name="logoUrl"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>产品描述：</label>-->
<!--                                <input type="text" name="descInfo"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>产品详情地址：</label>-->
<!--                                <input type="text" name="detailUrl"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label  class="font-noraml">是否联登：</label>-->
<!--                                <div class="col-sm-2" >-->
<!--                                    <select class="form-control"  name="unionLoginFlag">-->
<!--                                        <option value="">所有</option>-->
<!--                                        <option value="1">联登</option>-->
<!--                                        <option value="0">非联登</option>-->
<!--                                    </select>-->
<!--                                </div>-->
<!--                            </li>-->

                            <li>
                                <label  class="font-noraml">计价类型：</label>
                                <div class="col-sm-2" >
                                    <select class="form-control"  name="priceType">
                                        <option value="">所有</option>
                                        <option th:each="item:${proPriceList}" th:value="${item.value}" th:text="${item.name}"></option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="product:info:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('product:info:edit')}]];
        var removeFlag = [[${@permission.hasPermi('product:info:remove')}]];
        var prefix = ctx + "product/info";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "产品信息（下游/甲方）",
                columns: [
                //     {
                //     checkbox: true
                // },
                {
                    field: 'id',
                    title: 'id',
                },
                //     {
                //         field: 'sortWeight',
                //         title: '排序权重'
                //     },
                {
                    field: 'productName',
                    title: '产品名称'
                },
                {
                    // field: 'logoUrl',
                    title: 'logo地址',
                    formatter: function (value,row,index){
                        return $.table.imageView(row.logoUrl, 500, 500)
                    }
                },
                    {
                        field: 'typeStr',
                        title: '类型',
                        formatter: function (value,row,index){
                            var accountInfo = '';
                            if (row.type == 2){
                                accountInfo = '<span style="color: darkgreen; border-bottom: 1px solid" onclick="showAdminInfo(\''+row.userName+'\',\'' +row.userPwd+'\')">账号</span>';
                            }
                            return row.typeStr + accountInfo;
                        }
                    },

                {
                    field: 'priceTypeStr',
                    title: '价格类型'
                },
                {
                    field: 'descInfo',
                    title: '产品描述'
                },
                // {
                //     field: 'type',
                //     title: '产品类型'
                // },
                {
                    // field: 'detailUrl',
                    title: '产品详情',
                    formatter: function (value,row,index){
                        return row.unionLoginFlag?'-':'<a href="'+row.detailUrl+'" target="_blank">预览</a>';
                    }
                },

                {
                    field: 'applyNumber',
                    title: '申请人数'
                },
                {
                    field: 'productLabel',
                    title: '产品标签'
                },
                {
                    field: 'maxLoanAmount',
                    title: '最大贷款额度'
                },
                {
                    field: 'minLoanAmount',
                    title: '最小贷款额度'
                },
                {
                    field: 'interestRate',
                    title: '贷款利率'
                },
                {
                    field: 'maxLoanPeriod',
                    title: '最大贷款周期'
                },
                {
                    field: 'minLoanPeriod',
                    title: '最小贷款周期'
                },
                // {
                //     field: 'sortWeight',
                //     title: '排序权重'
                // },
                {
                    field: 'priceAmount',
                    title: '产品价格'
                },

                // {
                //     field: 'unionShowHours',
                //     title: '联登展示时长'
                // },
                // {
                //     field: 'unionLoginFlag',
                //     title: '是否联登产品',
                //     formatter: function (value,row,index){
                //         return row.unionLoginFlag?'<span class="badge badge-primary">是</span>':'<span class="badge badge-danger">否</span>';
                //     }
                // }
                // {
                //     field: 'adminUrl',
                //     title: 'A后台',
                //     formatter: function (value,row,index){
                //         return (row.adminUrl == undefined || row.adminUrl == '')?'-':'<a href="'+row.adminUrl+'" target="_blank">跳转</a>';
                //     }
                // },
                // {
                //     field: 'adminAccount',
                //     title: 'A账号'
                // },
                // {
                //     field: 'adminPasswd',
                //     title: 'A密码'
                // },
                // {
                //     field: 'channelKey',
                //     title: '渠道key'
                // },
                // {
                //     field: 'channelSecret',
                //     title: '渠道密钥'
                // },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function showAdminInfo(adminAccount, adminPwd) {
            var content = '账号：'+ adminAccount +
                '<br>密码：' + adminPwd
            $.modal.alert(content,modal_status.MESSAGE, '企微账号信息');
        }

    </script>
</body>
</html>